package com.ibeeking.found.open.api.feign;

import com.ibeeking.found.open.api.common.dto.OrderAddResultDTO;
import com.ibeeking.found.open.api.common.dto.OrderAmountDTO;
import com.ibeeking.found.open.api.common.dto.OrderChargebackDTO;
import com.ibeeking.found.open.api.common.param.ErpPayTypeParam;
import com.ibeeking.found.open.api.common.param.OrderAddParam;
import com.ibeeking.found.open.api.common.param.OrderChargebackParam;
import com.ibeeking.found.open.api.common.query.OrderAmountQuery;
import com.ibeeking.found.open.api.common.query.OrderChargebackQuery;
import com.ibeeking.found.open.api.feign.fallback.OrderFeignFallbackFactory;
import com.ibeeking.nematos.utils.result.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @Author ibeeking
 */
@FeignClient(name = "mall-order-c-server", path = "/c", contextId = "openOrderFeignClient", fallbackFactory = OrderFeignFallbackFactory.class, decode404 = true)
public interface OrderFeignClient {

    /**
     * 查询订单金额
     *
     * @param query
     * @return
     */
    @PostMapping("/v1/api/feign/order/queryAmount")
    ResponseResult<OrderAmountDTO> queryAmount(@RequestBody OrderAmountQuery query);

    /**
     * 支付成功订单新增
     *
     * @param param
     * @return
     */
    @PostMapping("/v1/api/feign/order/add")
    ResponseResult<OrderAddResultDTO> add(@RequestBody OrderAddParam param);

    /**
     * 订单查询退单
     *
     * @param query
     * @return
     */
    @PostMapping("/v1/api/feign/order/queryChargeback")
    ResponseResult<OrderChargebackDTO> queryChargeback(@RequestBody OrderChargebackQuery query);

    /**
     * 退货通知
     *
     * @param param
     * @return
     */
    @PostMapping("/v1/api/feign/order/chargeback")
    ResponseResult<Boolean> chargeback(@RequestBody OrderChargebackParam param);

    /**
     * 取消退货通知
     *
     * @param param
     * @return
     */
    @PostMapping("/v1/api/feign/order/cancelChargeback")
    ResponseResult<Boolean> cancelChargeback(@RequestBody OrderChargebackParam param);

    /**
     * 退货成功通知
     *
     * @param param
     * @return
     */
    @PostMapping("/v1/api/feign/order/successChargeback")
    ResponseResult<Boolean> successChargeback(@RequestBody OrderChargebackParam param);

    /**
     * 同步erp支付方式
     * @param params
     * @return
     */
    @PostMapping("/v1/api/feign/order/savePayType")
    ResponseResult<Boolean> savePayType(@RequestBody List<ErpPayTypeParam> params);
}
